<template>
  <div>
    <h1>欢迎来到八戒网</h1>
    <template>
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane
          v-for="(item, i) in catelist"
          :key="i"
          :label="item.cate_name"
          :name="String(item.id)"
        >
          <span v-for="(item, i) in cateinfolist" :key="i"
            ><el-button @click="tiao">{{ item.cate_name }}</el-button></span
          >
        </el-tab-pane>
      </el-tabs>
    </template>
  </div>
</template>
  </div>
</template>

<script>
export default {
  data() {
    return {
      activeName: '1',
      catelist: [],
      cateinfolist: [],
    };
  },
  methods: {
    getcate() {
      this.axios.get("/getmune").then((res) => {
        console.log(res);
        this.catelist = res.data.data;
      });
    },
    handleClick() {
      this.axios.get("/cateall?cateid=" + this.activeName).then((res) => {
        console.log(res);
        this.cateinfolist = res.data.data;
      });
    },
    tiao() {
      this.$router.push("/need");
    },
  },
  mounted() {
    this.getcate();
    this.handleClick()
  },
};
</script>

<style>
</style>